package com.yeswater.multithread.chapter7;

/**
 * author : yeswater
 * date : 2023/11/5
 *
 *  WAITING
 */

public class Run_7_1_4 {
    public static void main(String[] args) throws InterruptedException {
        MyThread t1 = new MyThread();
        t1.setName("a");
        t1.start();
        Thread.sleep(1000);
        System.out.println("main 方法中的t1状态 : " + t1.getState());

    }

    private static class MyThread extends Thread {

        @Override
        public void run() {
            try {
                synchronized (Lock.lock) {
                    Lock.lock.wait();
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    private static class Lock {
        public static final Byte lock = new Byte("0");
    }
}
